import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.*;
public class Test {
    //1.BC149简写字符
    // https://www.nowcoder.com/practice/0cfa856bf0d649b88f6260d878f35bb4?tpId=290&tqId=39937&ru=/exam/oj
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);

        while(in.hasNext()){
            char ch = in.next().charAt(0);

            if(ch >= 'a' && ch >= 'z'){
                System.out.print((char)(ch - -32));
            }else {
                System.out.print(ch);
            }
        }
    }

    /**
     * 2.dd爱框框
     * https://ac.nowcoder.com/acm/problem/221681
     */
    //法1：使用Scanner 但是会超时
    public static void main2_1(String[] args) {
        //滑动窗口
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int x = in.nextInt();

        int[] arr = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            arr[i] = in.nextInt();
        }

        int left =1,right =1,retLeft = -1,retRight = -1,retLen = n,sum = 0;
        //进入窗口
        while(sum <  x){
            sum += arr[right++];
            //出窗口
            while(sum >= x){
                    //更新
                    if(right - left + 1 < retLen){
                        retLeft = left;
                        retRight = right;
                        retLen = right - left + 1;
                    }
                    sum -= arr[left++];
            }
            right++;
        }
        System.out.println(retLeft + " " + retRight);
    }
    //法二：实现Read类
    public static void main(String[] args) throws IOException{
         Read read = new Read();
        int n = read.nextInt();
        int x = read.nextInt();

        int[] arr = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            arr[i] = read.nextInt();
        }

        int left =1,right =1,retLeft = -1,retRight = -1,retLen = n,sum = 0;
        //进入窗口
        while(sum <  x){
            sum += arr[right++];
            //出窗口
            while(sum >= x){
                //更新
                if(right - left + 1 < retLen){
                    retLeft = left;
                    retRight = right;
                    retLen = right - left + 1;
                }
                sum -= arr[left++];
            }
            right++;
        }
        System.out.println(retLeft + " " + retRight);
    }

    /**
     * 3.除2(贪心 + 堆)
     *https://ac.nowcoder.com/acm/problem/213140
     */

    public static void main3(String[] args) {
        Scanner in = new Scanner(System.in);

        int n = in.nextInt(),k = in.nextInt();
        int[] a = new int[n];

        //使用堆
        PriorityQueue<Integer> pq = new PriorityQueue<>( (a , b) -> {
            return b - a; }) ;

    //注意和的范围
    long sum = 0;
        for(int i =0;i < n;i++){
        a[i] = in.nextInt();
        sum += a[i];
        if(a[i] % 2 == 0){
            pq.add(a[i]);
        }
    }


        while(!pq.isEmpty() && k-- != 0 ){
        long t = pq.poll() / 2;
        sum -= t;
        if(t % 2 == 0){
            pq.add((int)t);
        }
    }

        System.out.println(sum);
   }
}
class Read {
    StringTokenizer st = new StringTokenizer("");
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

    String next() throws IOException {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(bf.readLine());
        }
        return st.nextToken();
    }

    String nextLine() throws IOException {
        return bf.readLine();
    }

    int nextInt() throws IOException {
        return Integer.parseInt((next()));
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }
    Double nextDouble() throws IOException{
        return Double.parseDouble(next());
    }
}
